<template>
  <div id="app">
    <div class="donghua">
      <img src="./assets/donghua.png" />
    </div>
    <router-view></router-view>
    <footer id="footer">
      <router-link to="/home/"><img src="./assets/foot11.png">
        <p>首页</p>
      </router-link>
      <router-link to="/market"><img src="./assets/foot2.png">
        <p>全国送</p>
      </router-link>
      <router-link to="/cart"><img src="./assets/foot3.png">
        <p>购物车</p>
        <span class="footer_allNum">{{numAll.length}}</span>
      </router-link>
      <router-link to="/mine"><img src="./assets/foot4.png">
        <p>我的</p>
      </router-link>
    </footer>
  </div>
</template>
  <script>
  import eventHub from './router/bus.js';
  export default {
    name : 'app',
    components: {eventHub},
    data (){
      return {
        numAll : eventHub.numAll
      }
    },
    mounted(){
      if(this.numAll.length == 0){
        document.querySelector(".footer_allNum").style.display = "none"
      }
    }
  }
  var timer = setInterval(function() {
    var donghua = document.querySelector(".donghua");
    var footer = document.querySelector("#footer");
    donghua.style.display = "none";
    footer.style.opacity = "1";
    clearInterval(timer);
  }, 3000)
</script>


<style>
  * {
    padding: 0;
    margin: 0;
  }

  html {
    font-size: 20px;
    color: #828282;
  }

  a {
    text-decoration: none;
  }

  li {
    list-style: none;
  }
  /*动画效果*/
  .donghua {
    width: 100%;
    height: 28.4rem;
    background: #4db9a9;
    animation: run 3s ease-in;
    position: fixed;
    z-index: 999;
  }

  .donghua img {
    width: 6.5rem;
    height: 6rem;
    margin-top: 39%;
    margin-left: 30%;
  }

  @-webkit-keyframes run {
    0% {
      opacity: 1;
    }
    50% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }

  footer {
    width: 100%;
    height: 1.85rem;
    position: fixed;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    text-align: center;
    border-top: 1px solid #828282;
    background: white;
    z-index: 9;
  }

  footer a {
    font-size: 0.4rem;
    display: inline-block;
    width: 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    color:#424643;
    position: relative;
  }

  footer a img {
    margin-top: 0.1rem;
    width: 1rem;
    height: 1rem;
    border: 0;
  }
  footer .router-link-active {
    background: #FFC000;
  }
  .footer_allNum{
    background: #F00;
    color: #fff;
    text-align: center;
    font: 0.8remrem/1rem "微软雅黑";
    padding: 0 0.2rem;
    position: absolute;
    top: 0.15rem;
    left: 3.5rem;
    border-radius: 0.2rem;
  }
</style>
